package com.example.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author readpage
 * @since 2023-02-03 16:15
 */
@Data
@NoArgsConstructor
@Schema(title = "User对象")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(title = "用户ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(title = "用户名")
    private String username;

    @Schema(title = "年龄")
    private Integer age;

    @Schema(title = "邮箱")
    private String email;

    @Schema(title = "手机号码")
    private String phone;

    @Schema(title = "头像")
    private String avatar;

    @Schema(title = "等级")
    private Integer level;

    @Schema(title = "个人主页")
    private String homeLink;

    @Schema(title = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(title = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    public User(Long id, String username, String avatar, Integer level, String homeLink) {
        this.id = id;
        this.username = username;
        this.avatar = avatar;
        this.level = level;
        this.homeLink = homeLink;
    }
}
